home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / MATHS / RLAB / RLAB125.ZIP / !RLaB / help_jr / readm < prev    next >
Text File  |  1995-05-30  |  2KB  |  64 lines

  1. readm:
  2.  
  3. Syntax:    readm ( FILENAME )
  4.     readm ( FILENAME, SIZE )
  5.  
  6. Description:
  7.  
  8.     Readm reads a generic matrix of data from the file denoted by
  9.     the string argument FILENAME. The return value is the newly
  10.     created matrix. The second, and optional, argument is a
  11.     two-element matrix that specifies the size ([NR, NC]) of the
  12.     matrix to read. 
  13.  
  14.     If SIZE is _not_ specified, then the matrix is filled row-wise
  15.     with the input data. Otherwise (SIZE is specified), the matrix
  16.     if filled column-wise, as the input is read.
  17.  
  18.     The file format is generic ASCII. The rows of the matrix are
  19.     separated by newlines, and the columns are separated by
  20.     whitespace. Unnecessary newlines, either before, or after the
  21.     data will confuse readm, and will probably result in an error
  22.     message. Only one matrix can be stored in a file. If you need
  23.     to store more than one matrix in a file, use write(), and
  24.     read(). 
  25.  
  26.     Readm can only read in numeric matrices. The result of reading
  27.     in string matrices is undefined.
  28.  
  29.     Example:
  30.  
  31.     1 2 3 4
  32.     5 6 7 8
  33.     9 10 11 12
  34.  
  35.     The above values in a file called "test" would be read in like:
  36.  
  37.     > a = readm("test")
  38.      a =
  39.      matrix columns 1 thru 4
  40.             1          2          3          4  
  41.             5          6          7          8  
  42.             9         10         11         12  
  43.  
  44.     Readm exists to read in data from other programs. In many
  45.     cases a simple awk script will filter the other programs
  46.     output into one or more columns of data. readm() will read the
  47.     data into the matrix, then the matrix can be reshaped if
  48.     necessary.
  49.  
  50.  
  51. Notes:
  52.  
  53.     Readm has no idea how many rows are in the matrix it is
  54.     reading. This is because readm can work with pipes and process
  55.     output where it gets the matrix as a stream. Readm uses a
  56.     heuristic to guess how many rows of the matrix to allocate at
  57.     one time. A second, optional argument, NROW can be specified
  58.     if the heuristic does not yield the performance you
  59.     desire. The heuristic is purposely memory conservative.
  60.  
  61.         readm ( "filename" , NROW )
  62.  
  63. See Also: reshape, getline, open, read, readb, write, writeb, writem
  64.